<script type="text/javascript">

var str="Welcome to Microsoft+++++";
//document.write(str.replace(/micros+++oft/gi, "W3Schools"));

/*function replaceall(Source,stringToFind,stringToReplace){
  var temp = Source;
    var index = temp.indexOf(stringToFind);
        while(index != -1){
            temp = temp.replace(stringToFind,stringToReplace);
            index = temp.indexOf(stringToFind);
        }
        return temp;
 }*/
 //ReplaceAll(str,'+','!');
 
 String.prototype.ReplaceAll = function(stringToFind,stringToReplace){
    var temp = this;
    var index = temp.indexOf(stringToFind);
        while(index != -1){
            temp = temp.replace(stringToFind,stringToReplace);
            index = temp.indexOf(stringToFind);
        }
        return temp;
    }

//var mytxt="I Love Dotnet";
function replacecall()
    {
        mytxt="I Love Dotnet+++++"; 
        alert(mytxt);
        alert(mytxt.ReplaceAll("+","!"));
    }
    
    replacecall();

</script> 